package cate.game.role.pvp.teampvp.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTeamPvp;
import cate.game.pvp.teampvp.dto.TeamPvpMatchData;

@ClientMsg(title = "刷新匹配结果的请求")
public class TeamPvpMatchRefreshReq implements MsgInput {
    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<TeamPvpMatchData> refreshRes = game.pvp.teamPvp.matchRefresh(cc.getRole());
        if (!refreshRes.ok()) {
            game.notice.message(cc.getRole(), refreshRes);
            return;
        }
        if (refreshRes.data == null) {
            return;
        }
        cc.sendNow(new TeamPvpMatchResp(refreshRes.data));
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTeamPvp.REFRESH_MATCH_REQ;
    }
}
